<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
   <style>
      html{
         font-size: 20px;
      }
      @media screen and (min-width: 340px) {
         html{
            font-size: 25px;
         }
      }
      @media screen and (min-width: 640px) {
         html{
            font-size: 50px;
         }
      }
      @media screen and (min-width:900px) {
         html{
            font-size: 100px;
         }
      }
      .box{
         height: 1rem;
         font-size: .8rem;
         background-color: greenyellow;
         color:ghostwhite;
         line-height: 1rem;
         text-align: center;
      }
   </style>
</head>
<body>
   <div class="box">这是一段文字</div>
</body>
</html>